package kr.hkit.powerjava.chapter22.collection;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List; //LinkedList의 부모는 List. List써도됨

public class LinkedListTest { //ArrayList랑 메소드 동일함 
	public static void main(String[] args) {
		List<String> arList = new LinkedList<>();
		arList.add("MILK");
		arList.add("BREAD");
		arList.add("BUTTER");
		
		arList.add(1, "APPLE");
		arList.set(2, "GRAPE"); //수정
		
		String temp = arList.remove(0); //제거
		System.out.println("제거된 문자열은 " + temp);
		
		Collections.sort(arList);
		
		for (String str : arList) {
			System.out.println(str);
		}
		
	}
}
